package com.srb.sms.util;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "rly")
@Data
public class SmsProperties implements InitializingBean {

    /*
    rly:
      accountSid: 8aaf070881ad8ad40181fa4b064512c1
      accountToken: bdad2a799b1e487b8aea3da4d26ce2cd
      appId: 8aaf070881ad8ad40181fa4b072812c8
      serverIp: app.cloopen.com
      serverPort: 8883
     */

    private String accountSid;
    private String accountToken;
    private String appId;
    private String serverIp;
    private String serverPort;

    public static String ACCOUNT_SID;
    public static String ACCOUNT_TOKEN;
    public static String APP_ID;
    public static String SERVER_IP;
    public static String SERVER_PORT;

    @Override
    public void afterPropertiesSet() throws Exception {
        ACCOUNT_SID = accountSid;
        ACCOUNT_TOKEN = accountToken;
        APP_ID = appId;
        SERVER_IP = serverIp;
        SERVER_PORT = serverPort;
    }
}
